package cn.iocoder.yudao.module.cmt.dal.mysql.base;

import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cmt.dal.dataobject.base.BaseMerchantApplyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.cmt.controller.admin.base.vo.*;

/**
 * 商户入驻申请 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BaseMerchantApplyMapper extends BaseMapperX<BaseMerchantApplyDO> {

    default PageResult<BaseMerchantApplyDO> selectPage(BaseMerchantApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseMerchantApplyDO>()
                .likeIfPresent(BaseMerchantApplyDO::getName, reqVO.getName())
                .eqIfPresent(BaseMerchantApplyDO::getCommunityId, reqVO.getCommunityId())
                .eqIfPresent(BaseMerchantApplyDO::getUserId, reqVO.getUserId())
                .eqIfPresent(BaseMerchantApplyDO::getMerchantType, reqVO.getMerchantType())
                .eqIfPresent(BaseMerchantApplyDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(BaseMerchantApplyDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BaseMerchantApplyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BaseMerchantApplyDO::getId));
    }

}
